copyq:
var img_formats = ["text/plain", "text/html", "image/jpeg", "image/png"]

for(var i=0 ; i < img_formats.length ; i++) {
    imageData = read(img_formats[i], 0)
    if (str(imageData).length != 0) {
        write("text/plain", imageData);
        print(read(0));
        remove(0);
        break
    }
}